#ifndef _CAM_H
#define _CAM_H

#ifndef __CAM_H__
#define	__CAM_H__

#define SIZE 16
#define REQBUFS_COUNT   4
#define CAMERA_USB "/dev/video0"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>

extern pthread_mutex_t cam_mutex;

char *buf;
unsigned size;
unsigned index_pic;
int cam_fd;

struct cam_buf {
		void *start;
		size_t length;
};
struct v4l2_requestbuffers reqbufs;       
struct cam_buf bufs[REQBUFS_COUNT];  
int camera_init(char *devpath, unsigned int *width, unsigned int *height, unsigned int *size);
int camera_start(int fd);
int camera_dqbuf(int fd, void **buf, unsigned int *size, unsigned int *index);
int camera_eqbuf(int fd, unsigned int index);
int camera_stop(int fd);
int camera_exit(int fd);
int pic_send(int camfd ,int fd);
int cam_init();

void *cam_func(void *arg);

// typedef struct{
// 	char pic_buf[1024*1024];
// 	int pic_len;
// }Cam_t;


struct cam_t{
    char pic_buf[1024*1024];
    int pic_len;
};
// extern Cam_t CamData;

#endif

#endif
